package main

func main() {
	println(arrangeCoins(8))
}

/**
 *	arrangeCoins
 *	@Description:排列硬币
 *	@param n int
 *	@return count int
 */
func arrangeCoins(n int) (count int) {
	i := 1
	for {
		if n == 0 {
			return
		} else if n < 0 {
			count--
			return
		}
		n -= i
		count++
		i++
	}
}
